var mysql      = require('mysql');
var connection = mysql.createConnection({
  host     : 'localhost',
  user     : 'jdl',
  password : 'Abc414761691',
  database : 'test'
});

module.exports = function mysqldemo(sql) {
    connection.connect();
    if (sql == undefined) {
        sql = "SELECT 1 + 1 + ? AS solution";
        var params = [23];
        connection.query(sql, params, function (error, results, fields) {
            if (error) {
                throw error;
            }
            console.log('The solution is: ', results[0].solution);
        });
    }
    connection.end;
}